package com.oocl.euc.core.maintenance.controller;

import com.oocl.euc.core.maintenance.model.Status;
import com.oocl.euc.core.maintenance.service.StatusService;
import com.oocl.euc.framework.base.controller.RESTController;
import com.oocl.euc.framework.base.service.BaseService;
import com.oocl.euc.framework.common.utils.ResponseEntityUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/rest/status")
public class StatusController extends RESTController<Status, Long> {

    @Autowired
    StatusService statusService;

    @Override
    protected BaseService<Status, Long> getBaseService() {
        return statusService;
    }


    @RequestMapping("/findStatus")
    public ResponseEntity findStatusByStatusType(@RequestParam("statusType") String statusType){
        return ResponseEntityUtil.successInRestful(statusService.getStatusByType(statusType));
    }
}
